// hyb_yl/answer_detail/answer_detail.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    answerArr: [
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var that = this
    var id = options.p_id
    var openid = wx.getStorageSync('openid')
    var user_openid = options.user_openid
    that.setData({
      user_openid: user_openid,
      id: id,
      openid:openid
    })
    app.util.request({
      'url': "entry/wxapp/Zhuanjiaxiangqing",
      data: {
        id: id
      },
      success: function(res) {
        console.log(res)
        that.setData({
          xiangqing: res.data.data,
        })
      },
      fail: function(err) {
        // console.log(err)
      },
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {
    this.getSelecthzq()
    this.getBase()
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  },
  //查询患者提问
  getSelecthzq: function() {
    var that = this
    var user_openid = that.data.user_openid
    var zid = that.data.id
    app.util.request({
      'url': 'entry/wxapp/Selethzq',
      data: {
        user_openid: user_openid,
        zid: zid
      },
      success: function(res) {
        console.log(res)
        that.setData({
          answerArr: res.data.data
        })
      }
    })
  },
  index: function() {
    wx.reLaunch({
      url: '/hyb_yl/tabBar/index/index',
    })
  },
  doc:function(){
    var that = this
    var openid = wx.getStorageSync('openid')
    var id = that.data.id
    wx.navigateTo({
      url: '/hyb_yl/zhuanjiasubpages/pages/zhuanjiatiwen/zhuanjiatiwen?id='+id+ '&openid='+openid,
    })
  },
  getBase: function () {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/Base',
      success: function (res) {
        //console.log(res)
        that.setData({
          base: res.data.data
        })
      },
      fail: function (err) {
        //console.log(err)
      },
    })
  },
})